package flc.ast.adapter;

import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.MyAlbumBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class AlbumAdapter extends StkProviderMultiAdapter<MyAlbumBean> {

    public AlbumAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(80));
        addItemProvider(new AlbumProvider());
    }

    private boolean isPrivacy = false;

    public void setPrivacy(boolean privacy) {
        isPrivacy = privacy;
    }

    private class AlbumProvider extends BaseItemProvider<MyAlbumBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_album;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MyAlbumBean bean) {
            Glide.with(getContext()).load(bean.getList().get(0).getPath())
                    .into((ImageView) baseViewHolder.getView(R.id.ivAlbumItemImg));
            baseViewHolder.setText(R.id.tvAlbumItemName, bean.getName());
        }
    }
}
